package org.tote.command;

import java.util.ArrayList;
import java.util.List;

import org.tote.model.User;

/**
 * Command bean for list of users
 */
public class UserListCommand extends AbstractListCommand {

	private List<UserCommand> userList = new ArrayList<UserCommand>();

	public UserListCommand() {
	}

	public UserListCommand(List<User> userList) {
		this(userList, 0, false, "");
	}

	public UserListCommand(List<User> userList, int page, boolean more, String searchFilter) {
		super(page, more, searchFilter);
		if (userList == null) {
			throw new IllegalArgumentException(
					"userList cannot be null when constructing new UserList command");
		}
		this.userList = new ArrayList<UserCommand>();
		for (User user : userList) {
			this.userList.add(new UserCommand(user));
		}
	}

	/**
	 * Gets list of ID's of checked user
	 * @return - list of ID's of users
	 */
	public List<String> getCheckedIdList() {
		List<String> idList = new ArrayList<String>();
		/*
		for (UserCommand command : this.userList) {
			if (command.isSelected()) {
				idList.add(command.getMail());
			}
		}
		*/
		return idList;
	}

	/**
	 * @return the userSet
	 */
	public List<UserCommand> getUserList() {
		return userList;
	}

	/**
	 * @param userList the userList to set
	 */
	public void setUserList(List<UserCommand> userList) {
		this.userList = userList;
	}

}
